export const formdata = {
    formDate
}

function formDate(str: any) {
    const date = new Date(str);
    const year = date.getFullYear();//返回4位数的年份
    const month = zero(date.getMonth() + 1);//返回0-11
    const day = zero(date.getDate());//1-31
    const hour = zero(date.getHours());//0-23
    const minute = zero(date.getMinutes());//0-59
    const second = zero(date.getSeconds());//0-59
    return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second
}
function zero(n: number) {
    return n > 9 ? n : "0" + n
}